function [alphad, bankd] = calCommands(alt, V, fpadotd, azidotd, fpa)
    % calculate the guidance commands
    global mass g S alphamin alphamax
    [rho, sos] = getAtmosphere(alt);
    Ma = V/sos;
    q = 0.5*rho*V^2;
    % required control force in the longitudinal plane
    F_lon = mass*(V*fpadotd + g*cos(fpa)); 
    % required control force in the lateral plane
    F_lat = mass*V*azidotd*cos(fpa);
    % 式(21)
    Ld = sqrt(F_lon^2 + F_lat^2);
    fun = @(alpha)abs(Ld - ...
          q*S*(0.4172+19.41*alpha+10.17*alpha^2-Ma*(0.1004+0.7536*alpha)));
    % 式(20)
    alphad = fminbnd(fun, alphamin, alphamax);
    % 式(22)
    bankd = atan2(F_lat, F_lon); 
end